package lzzy.edu.cn.demothymeleaf.service;

import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Service;

@Service
public class RabbitMQService {

    @RabbitListener(bindings = @QueueBinding(value =
    @Queue("fanout_queue_test"), exchange =
    @Exchange(value = "fanout_exchange", type = "fanout")))
    public void fanoutTest(String msg){
        System.out.println("第二个队列接收到的信息"+msg);
    }

    @RabbitListener(bindings=@QueueBinding(value =
    @Queue("fanout_queue2_test"), exchange =
    @Exchange(value = "fanout_exchange", type = "fanout")))
    public void fanout2Test(String msg){
        System.out.println("第二队列收到信息:"+msg);
    }
}
